package tp.pr5.items;

import tp.pr5.Player;
import tp.pr5.Room;

public class Food extends ExpirationItem
{
	private int health;

	public Food(String name, String description, int health, int times)
	{
		super(name, description, times);
		this.health = health;
	}

	public Food(String name, String description, int health)
	{
		super(name, description, 1);
		this.health = health;
	}

	public boolean use(Player who, Room where)
	{
		boolean usar=true;
		if (!this.canBeUsed())
		{
		who.itemEmpty(this.id);	
		usar= false;
		this.id="";
		}
		else
		{
			who.requestPlayerUpdate();
			who.itemUsed(this.id);
			
			who.addHealth(this.health);
			if (this.times<=1)
				who.itemEmpty(this.id);	
			this.decrement();
		}
		return usar;

	}

}
